package com.wonders.frame.entity;

import com.wonders.frame.core.entity.EntityTemplate;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;
import java.util.Set;

@SuppressWarnings("serial")
@Entity
@Data
@Table(name = "auth_account")
public class AuthAccount extends EntityTemplate {
    @OneToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "user_id", referencedColumnName = "id")
    private AuthUser user;

    //@JsonIgnore
    @ManyToMany(cascade=CascadeType.MERGE,fetch = FetchType.EAGER)
    @JoinTable(name = "auth_account_role",joinColumns = {@JoinColumn(name="account_id",referencedColumnName = "id")},
            inverseJoinColumns = {@JoinColumn(name = "role_id",referencedColumnName = "id")})
    private Set<AuthRole> roles;
    @Column(name = "orga_id")
    private String orgaId;
    @Column(name = "account")
    private String account;
    @Column(name = "password")
    private String password;
    @Column(name = "type")
    private String type;
    @Column(name = "dept_id")
    private String deptId;

    @Column(name = "error_count")
    private Integer errorCount;

    @Column(name = "account_status")
    private Integer accountStatus;

    @Column(name = "exp_date")
    private Date expDate;

}
